var admims_login = {
	init:function()
	{
		admims_login.intForm();
		admims_login.init_enter_event();						
	},
	intForm:function()
	{
		var $submit_btn = $('#submit_btn');
		var $form = $('#login_form');
		
	
		if($submit_btn.length > 0){
		     $submit_btn.click(function(){
				   var $username = $('#username');
				   var $password = $('#password');
				   var uval = pavl = '';
				   uval =  $.trim($username.val());
				   pavl =  $.trim($password.val());
				   if(uval==''){
					   alert('请输入用户名！');
					   $username.focus();
					   return false;
				   }
				   if(pavl==''){
					   alert('请输入密码！');
					   $password.focus();
					   return false;
				   }
                   $form.submit();
             });
		}
	
		
		/*
	   if(!validate()){
         return false;
	   }
	  
		
	   $form.submit(); */
	   	
	},
	init_enter_event:function(){

		document.onkeydown = function(e){ 
            var ev = document.all ? window.event : e;
			   if(ev.keyCode==13) {
                   $("#submit_btn").trigger("click");
              }
        }

	}
	
}


$(function(){
    admims_login.init();
});